/*
题目地址:https://leetcode-cn.com/problems/arranging-coins/
题目标签:数学
*/

#include <math.h>

class Solution {
   public:
    int arrangeCoins(int n) {
        int res = (int)(pow(8 * (double)n + 1, 0.5) - 1) / 2;
        return res;
    }
};